package com.longteng.lesson2.controller;

import com.longteng.lesson2.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Controller
@RequestMapping("/freemarker")
public class FreemarkerController {
    @RequestMapping("/free")
    public String free(Model model){
        model.addAttribute("name","longteng");
        model.addAttribute("money",8888);
        model.addAttribute("time",new Date());
        User user=new User();
        user.setName("小象");
        user.setAge(18);
        List list=new ArrayList();
        list.add(user);
        User user1 =new User();
        user1.setName("龙腾");
        user1.setAge(22);
        list.add(user1);
        model.addAttribute("userList",list);
        List list1 =new ArrayList();
        list1.add("a");
        list1.add("b");
        list1.add("c");
        model.addAttribute("aList",list1);
        model.addAttribute("user",user);
        return "free/freemarker";
    }
}
